package com.erclab.internal.xpresso.reportelements;

import com.erclab.internal.xpresso.exceptions.ReportException;
import com.erclab.internal.xpresso.reports.Report;

/*import java.io.*;

import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;*/

public class HtmlFreeElement extends ReportElement {

	
	/*public class Html2Text extends HTMLEditorKit.ParserCallback
	 {
		 StringBuffer s;
		
		 public Html2Text() {}
		
		 public void parse(Reader in) throws IOException {
		   s = new StringBuffer();
		   ParserDelegator delegator = new ParserDelegator();
		   delegator.parse(in, this, false);
		
		   }
		
		 public void handleText(char[] text, int pos) {
		   s.append(text);
		   }
		
		 public String getText() {
		   return s.toString();
		   }
	 }*/
	
	
	
	@Override
	public String toHTML(String columnValue, String uniqueKeyValue,
			Report theReport) throws ReportException {
		
		/*Html2Text parser = new Html2Text();
		Reader in = new StringReader(columnValue);
		try {
			parser.parse(in);
		} catch (IOException e) {
			log.error("Parsing HTML failed: " + e);
			e.printStackTrace();
		}*/
		if (columnValue != null){
			return columnValue.replaceAll("\\<.*?\\>", " ");

		}
		return columnValue;
	}

}
